<?php  
function download($nom_fic){
	if (isset($nom_fic))
	{
		$tmp = $nom_fic;
		// Envoi du fichier
		// set the content as octet-stream
		header("Content-Type: application/octet-stream");
		
		// tell the thing the filesize
		header("Content-Length: " . filesize($tmp));
		
		// set it as an attachment and give a file name
		header('Content-Disposition: attachment; filename="'.$tmp.'"');
		// read into the buffer
		readfile($tmp);
		unlink($tmp);
	}
}
?>
